/**
  * Cube
  *
  * @author jh3y - jheytompkins.com
*/

$size: 40px;
$color-one: red;
$color-two: orange;
$color-three: yellow;
$color-four: green;
$color-five: blue;
$color-six: indigo;

@keyframes cube {
  0% {
    transform: rotate(45deg) rotateX(-25deg) rotateY(25deg);
  }
  50% {
    transform: rotate(45deg) rotateX(-385deg) rotateY(25deg);
  }
  100% {
    transform: rotate(45deg) rotateX(-385deg) rotateY(385deg);
  }
}


.cube {
  animation: cube 2s infinite ease;
  height: $size;
  transform-style: preserve-3d;
  width: $size;

  div {
    background-color: rgba(255, 255, 255, 0.25);
    height: 100%;
    position: absolute;
    width:  100%;
    border: 2px solid white;

    &:nth-of-type(1) {
      transform: translateZ(-($size / 2)) rotateY(180deg);
    }

    &:nth-of-type(2) {
      transform: rotateY(-270deg) translateX(50%);
      transform-origin: top right;
    }

    &:nth-of-type(3) {
      transform: rotateY(270deg) translateX(-50%);
      transform-origin: center left;
    }

    &:nth-of-type(4) {
      transform: rotateX(90deg) translateY(-50%);
      transform-origin: top center;
    }

    &:nth-of-type(5) {
      transform: rotateX(-90deg) translateY(50%);
      transform-origin: bottom center;
    }

    &:nth-of-type(6) {
      transform: translateZ(($size / 2));
    }
  }

}
